﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Main_Wap.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<%@ Import Namespace="tophd2.Classes.Helper" %>
<%@ Import Namespace="tophd2.Models.Entity" %>
<%@ Import Namespace="tophd2.Models.Service" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    NewsByCategory
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% 
        var hotNews = (List<HotItem>)ViewData["hotNews"];
        var hotListNews = (List<News>)ViewData["nListHot"];
        var newListNews = (List<News>)ViewData["nListNew"];
        var hotListNews2 = (List<News>)ViewData["nList"];
        var newListNews2 = (List<News>)ViewData["nList2"];
        int totalRecord = ViewBag.totalRecord;
        int hotpage = ViewBag.hotpage;
        int newpage = ViewBag.newpage;
    %>
    <div id="searchbox">
        <div class="keyword">
            <span class="hot">Chủ đề HOT</span>:
            <% if (!ReferenceEquals(hotNews, null))
               {
                   for (int i = 0; i < hotNews.Count; i++)
                   {
                       if (i < hotNews.Count - 1)
                       { %>
            <a href="/News/NewsDetail?id=<%= hotNews[i].NewsId %>">
                <%= hotNews[i].Title %></a> <span style="font-size: 12px;">|</span>
            <% }
                       else
                       {%>
            <a href="/News/NewsDetail?id=<%= hotNews[i].NewsId %>">
                <%= hotNews[i].Title %></a>
            <%}
                   }
               }%>
        </div>
    </div>
    <div class="clear">
    </div>
    <div id="content">
        <h2>
            <span><span>HOT</span> nhất</span></h2>
        <div class="v-list">
            <% if (!ReferenceEquals(hotListNews, null))
               {
                   foreach (News news in hotListNews)
                   { %>
            <div class="v-item ">
                <table>
                    <tbody>
                        <tr valign="top">
                            <td class="left">
                                <a href="/News/NewsDetail?id=<%= news.NewsId %>">
                                    <img alt="<%= news.Title %>" src="http://vipmobi.net:7001/mobile/download?v=1&w=250&id=<%= news.Icon %>">
                                </a>
                            </td>
                            <td class="right">
                                <div class="title">
                                    <a href="/News/NewsDetail?id=<%= news.NewsId %>">
                                        <%= news.Title%>
                                    </a>
                                </div>
                                <div class="subtitle">
                                    <span>4 Lượt xem </span>
                                    <div class="clearfix">
                                    </div>
                                    <span>
                                        <!--								<img src="/themes/avideo_v2/images/icon_streaming.gif"/> -->
                                        <a href="/News/NewsDetail?id=<%= news.NewsId %>">Xem </a></span>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <% }
               } %>
            <% if (!ReferenceEquals(hotListNews2, null))
               {
                   foreach (News news in hotListNews2)
                   { %>
            <div class="v-item ">
                <table>
                    <tbody>
                        <tr valign="top">
                            <td class="left">
                                <a href="/News/NewsDetail?id=<%= news.NewsId %>">
                                    <img alt="<%= news.Title %>" src="http://vipmobi.net:7001/mobile/download?v=1&w=250&id=<%= news.Icon %>">
                                </a>
                            </td>
                            <td class="right">
                                <div class="title">
                                    <a href="/News/NewsDetail?id=<%= news.NewsId %>">
                                        <%= news.Title%>
                                    </a>
                                </div>
                                <div class="subtitle">
                                    <span>4 Lượt xem </span>
                                    <div class="clearfix">
                                    </div>
                                    <span>
                                        <!--								<img src="/themes/avideo_v2/images/icon_streaming.gif"/> -->
                                        <a href="/News/NewsDetail?id=<%= news.NewsId %>">Xem </a></span>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <% }
               } %>
        </div>
        <div class="clearfix">
        </div>
        <%--<ul class="home-nav">
            <%
                int totalpage = totalRecord % 3 == 0 ? totalRecord / 3 : totalRecord / 3 + 1;
                for (int i = 1; i <= totalpage; i++)
                {
                    if (ViewBag.cateId != null)
                    {%>
            <li class='<%=i==hotpage?"active":"" %>'><a href="/Category/NewsByCategory?categoryId=<%=ViewBag.cateId %>&hotpage=<%=i %>">
                <%=i %></a></li>
            <%}
                    else
                    {%>
            <li class='<%=i==hotpage?"active":"" %>'><a href="/Category/NewsByCategory?hotpage=<%=i %>">
                <%=i %></a></li>
            <%}
                } %>
        </ul>--%>
        <%= Html.Paging(hotpage, 3, totalRecord, 1)%>
        <div class="clearfix">
        </div>
        <h2>
            <span><span>Mới</span> nhất</span></h2>
        <div class="v-list">
            <% if (!ReferenceEquals(newListNews, null))
               {
                   foreach (News news in newListNews)
                   { %>
            <div class="v-item ">
                <table>
                    <tbody>
                        <tr valign="top">
                            <td class="left">
                                <a href="/News/NewsDetail?id=<%= news.NewsId %>">
                                    <img alt="<%= news.Title %>" src="http://vipmobi.net:7001/mobile/download?v=1&w=250&id=<%= news.Icon %>">
                                </a>
                            </td>
                            <td class="right">
                                <div class="title">
                                    <a href="/News/NewsDetail?id=<%= news.NewsId %>">
                                        <%= news.Title%>
                                    </a>
                                </div>
                                <div class="subtitle">
                                    <span>4 Lượt xem </span>
                                    <div class="clearfix">
                                    </div>
                                    <span>
                                        <!--								<img src="/themes/avideo_v2/images/icon_streaming.gif"/> -->
                                        <a href="/News/NewsDetail?id=<%= news.NewsId %>">Xem </a></span>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <% }
               } %>
            <% if (!ReferenceEquals(newListNews2, null))
               {
                   foreach (News news in newListNews2)
                   { %>
            <div class="v-item ">
                <table>
                    <tbody>
                        <tr valign="top">
                            <td class="left">
                                <a href="/News/NewsDetail?id=<%= news.NewsId %>">
                                    <img alt="<%= news.Title %>" src="http://vipmobi.net:7001/mobile/download?v=1&w=250&id=<%= news.Icon %>">
                                </a>
                            </td>
                            <td class="right">
                                <div class="title">
                                    <a href="/News/NewsDetail?id=<%= news.NewsId %>">
                                        <%= news.Title%>
                                    </a>
                                </div>
                                <div class="subtitle">
                                    <span>4 Lượt xem </span>
                                    <div class="clearfix">
                                    </div>
                                    <span>
                                        <!--								<img src="/themes/avideo_v2/images/icon_streaming.gif"/> -->
                                        <a href="/News/NewsDetail?id=<%= news.NewsId %>">Xem </a></span>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <% }
               } %>
        </div>
        <div class="clearfix">
        </div>
        <%--<ul class="home-nav">
            <%                
                for (int i = 1; i <= totalpage; i++)
                {
                    if (ViewBag.cateId != null)
                    {%>
            <li class='<%=i==newpage?"active":"" %>'><a href="/Category/NewsByCategory?categoryId=<%=ViewBag.cateId %>&newpage=<%=i %>">
                <%=i %></a></li>
            <%}
                    else
                    {%>
            <li class='<%=i==newpage?"active":"" %>'><a href="/Category/NewsByCategory?newpage=<%=i %>">
                <%=i %></a></li>
            <%}
                } %>
        </ul>--%>
        <%= Html.Paging(newpage, 3, totalRecord, 0)%>
    </div>
    <% CategoryService s1 = new CategoryService();
       List<Category> newsCategory = s1.GetCategory(0, 3);
       NewsService nser = new NewsService();
    %>
    <div class="menu">
        <div class="clearfix">
        </div>
        <h2>
            <span><span>Chuyên</span> mục con</span></h2>
        <div>
            <ul class="main-cat">
                <% foreach (Category cate in newsCategory)
                   {
                       if (cate.IsLeaf == 1)
                       { %>
                <li class=" "><a href="/Category/NewsByCategory?categoryId=<%=cate.CategoryId %>"><b>
                    <%= cate.Name %></b> </a></li>
                <% News v = nser.GetNews(cate.CategoryId, 0, 1, 2)[0]; %>
                <div class="v-list">
                    <div class="v-item last">
                        <table>
                            <tbody>
                                <tr valign="top">
                                    <td class="left">
                                        <a href="/News/NewsDetail?id=<%= v.NewsId %>">
                                            <img alt="<%= v.Title %>" src="http://vipmobi.net:7001/mobile/download?v=1&w=500&h=500&id=<%= v.Icon %>">
                                            
                                        </a>
                                    </td>
                                    <td class="right">
                                        <div class="title">
                                           <a href="/News/NewsDetail?id=<%= v.NewsId %>">
                                                <%= v.Title %></a></div>
                                        <div class="subtitle">
                                            <span>24 lượt xem </span>
                                            <div class="clearfix">
                                            </div>
                                            <span>
                                                <!--								<img src="/themes/avideo_v2/images/icon_streaming.gif"/> -->
                                                <a href="/News/NewsDetail?id=<%= v.NewsId %>">(Xem/3000d) </a></span>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
                <% }
                       else
                       {
                           List<Category> imageCategory2 = s1.GetCategory(cate.CategoryId, 3);
                           foreach (Category cate2 in imageCategory2)
                           {
                               if (cate2.IsLeaf == 1)
                               { %>
                <li class=" "><a href="/Category/NewsByCategory?categoryId=<%=cate2.CategoryId %>">
                    <b>
                        <%= cate2.Name %></b> </a></li>
                <% News v = nser.GetNews(cate2.CategoryId, 0, 1, 2)[0]; %>
                <div class="v-list">
                    <div class="v-item last">
                        <table>
                            <tbody>
                                <tr valign="top">
                                    <td class="left">
                                        <a href="/News/NewsDetail?id=<%= v.NewsId %>">
                                            <img alt="<%= v.Title %>" src="http://vipmobi.net:7001/mobile/download?v=1&w=500&h=500&id=<%= v.Icon %>">
                                            
                                        </a>
                                    </td>
                                    <td class="right">
                                        <div class="title">
                                            <a href="/News/NewsDetail?id=<%= v.NewsId %>">
                                                <%= v.Title %></a></div>
                                        <div class="subtitle">
                                            <span>24 lượt xem </span>
                                            <div class="clearfix">
                                            </div>
                                            <span>
                                                <!--								<img src="/themes/avideo_v2/images/icon_streaming.gif"/> -->
                                                <a href="/News/NewsDetail?id=<%= v.NewsId %>">(Xem/3000d) </a></span>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
                <% }
                           }
                       }
                   } %>
            </ul>
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="metaheader" runat="server">
</asp:Content>
